package com.lm.service.impl;

import com.lm.dao.LmTrackEventInfoDao;
import com.lm.model.LmTrackEventInfo;
import com.lm.service.LmTrackEventInfoService;
import com.meirengu.model.Page;
import com.meirengu.service.impl.BaseServiceImpl;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * LmTrackEventInfo服务实现层
 *
 * @author Mao
 * @create Sat Jun 09 15:34:19 CST 2018
 */
@Service
public class LmTrackEventInfoServiceImpl extends BaseServiceImpl<LmTrackEventInfo> implements LmTrackEventInfoService {

    @Autowired
    LmTrackEventInfoDao lmTrackEventInfoDao;

    @Override
    public Page getListById(Page page, Map map) {
        int startPos = page.getStartPos();
        int pageSize = page.getPageSize();
        RowBounds rowBounds = new RowBounds(startPos, pageSize);
        List<Map<String, Object>> aList = lmTrackEventInfoDao.getPageById(map, rowBounds);
        int totalCount = lmTrackEventInfoDao.getCountById(map);
        page.setTotalCount(totalCount);
        page.setList(aList);
        page.init();
        return page;
    }
}
